<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8>
	<title>客户管理系统</title>
    <base href="<%=basePath%>">
	<link rel="stylesheet" type="text/css" href="bootstrap-rs/themes/black/easyui.css">
	<link rel="stylesheet" type="text/css" href="bootstrap-rs/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="bootstrap-rs/demo.css">
	<script type="text/javascript" src="bootstrap-rs/jquery.min.js"></script>
	<script type="text/javascript" src="bootstrap-rs/jquery.easyui.min.js"></script>
</head>
<body>
	
	

	
		<table id="qg" border="1" width=100% height=20% >
			<tr><td colspan="3" align="center">高级搜索</td></tr>
			<tr>
				<td>
					省份:
					<select id="groupprovince" name="groupprovince">
						<option>==所有省份==</option>
						<c:forEach items="${provinces}" var="p">
							<option value="${p.provincename}">${p.provincename}</option>
						</c:forEach>
					</select>
				</td>
				
				<td>
					所在地区:
					<select id="grouparear" name="grouparear">
						<option>==所有地区==</option>
						<c:forEach items="${arealist}" var="ar">
							<option value="${ar.areaname}">${ar.areaname}</option>
						</c:forEach>
					</select>
				</td>
				
				<td>集团编号:<input type="text" id="groupid" name="groupid"></td>
			</tr>
			
			<tr>
				<td>
					所在城市:
					<select id="groupcity" name="groupcity">
						<option>==所有城市==</option>
						<c:forEach items="${citylist}" var="ci">
							<option value="${ci.cityname}">${ci.cityname}</option>
						</c:forEach>
					</select>
				</td>
				<td>
					所属行业:
					<select id="groupindustry" name="groupindustry">
						<option>==所有行业==</option>
						<c:forEach items="${industry}" var="i">
							<option value="${i}">${i}</option>
						</c:forEach>
					</select>
				</td>
				
				<td>集团名称:<input type="text" id="groupname" name="groupname"></td>
			</tr>
			
			<tr>
				<td>
					客户经理:
					<select id="groupcustommanager" name="groupcustommanager">
						<option>==请选择==</option>
						<c:forEach items="${managerlist}" var="ma">
							<option value="${ma.myid}">${ma.myname}</option>
						</c:forEach>
					</select>	
				</td>
			
				<td>
					集团状态 :
					<select id="groupstatus" name="groupstatus">
						<option>==请选择==</option>
						<c:forEach items="${statuslist}" var="sl">
							<option value="${sl.myid }">${sl.myname}</option>
						</c:forEach>
					</select>
				</td>
				
			</tr>
			
			
			<tr><td colspan="3" align="center"><input type="button" value="查询" onclick="chaxun()"></td></tr>
		</table>
	

	
	
	<table id="dg" class="easyui-datagrid" title="集团资料"
			data-options="url:'crm/group/advancedsearch',method:'post',singleSelect:'true'
			,fit:true,fitColumns:true,pagination:true,pagePosition:'bottom',rownumbers:true
			,scrollbarSize:0">
		<thead>
			<tr>
				<th field="ck" checkbox="true"></th>
				<th data-options="field:'groupid',width:80">集团编号</th>
				<th data-options="field:'groupname',width:100">集团名称</th>
				<th data-options="field:'groupprovince',width:80">所在省份</th>
				<th data-options="field:'groupcity',width:80">所在城市</th>
				<th data-options="field:'grouparear',width:100">所在地区</th>
				<th data-options="field:'grouplevel',width:100">集团等级</th>
				<th data-options="field:'groupindustry',width:100">所属行业</th>
				<th data-options="field:'groupstatus',width:100">集团状态</th>
			</tr>
		</thead>
	</table>
	<div id="tb">
		<!-- <input class="easyui-textbox" data-options="prompt:'Enter a email address...'" style="width:160px;height:25px"> -->
		<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:80px;" onclick="query()">查询</a>  
		<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" style="width:80px" onclick="insert()">添加</a>  
		<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" style="width:80px" onclick="groupdelete()">删除</a>  
		<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" style="width:80px" onclick="groupupdate()">修改</a>  
	</div>

	
</body>
<script type="text/javascript">
$('#dg').datagrid({
	toolbar: '#tb'
});

function query(){
	$('#dg').datagrid({ 
		
	});
	var rows = $('#dg').datagrid('getSelections');
	var r = rows[0].groupid;
	window.location.href="<%=basePath%>/crm/group/querydetail?id="+r;
}

	/**
	*删除集团数据
	*/
	function groupdelete()
	{
		$.messager.confirm('Confirm','Are you sure you want to delete record?',function(r){
		    if (r){
		    	var rows = $('#dg').datagrid('getSelections');
				var ro = rows[0].groupid;
				$.get('crm/group/groupdelete?id='+ro,function(){
					$('#dg').datagrid('reload');
				})
		    }
		});
	}

	/**
	更新集团数据
	*/
	function groupupdate()
	{
		$.messager.confirm('Confirm','Are you sure you want to update record?',function(r){
			if (r){
					var rows = $('#dg').datagrid('getSelections');
					var ro = rows[0].groupid;
					window.location.href="<%=basePath%>/crm/group/groupupdate?id="+ro;
				}
			});
	}
	
	/**
	*添加集团数据
	*/
	function insert(){
		window.location.href="<%=basePath%>/crm/group/groupinsert";
	}


	function chaxun(){
			$('#dg').datagrid('reload', {
				
					groupprovince:$('#groupprovince').val()
					/*
					,grouparear:$('#grouparear').val()

					,groupid:$('#groupid').val()
					,groupcity:$('#groupcity').val()
					,groupindustry:$('#groupindustry').val()
					,groupname:$('#groupname').val()
					,groupcustommanager:$('#groupcustommanager').val()
					
					groupstatus:$('#groupstatus').val()
					*/
				});
	}
</script>

</html>